package com.wf.course.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.utils.page.PageBean;
import com.wf.course.dao.IMemberInvitationMapper;
import com.wf.course.model.goods.GoodsOrder;
import com.wf.course.model.member.MemberInvitation;
import com.wf.course.service.IMemberInvitationService;

@Service
@Transactional
public class IMemberInvitationServiceImpl implements IMemberInvitationService {

	@Autowired
	private IMemberInvitationMapper mapper;
	
	@Override
	public void getMemberInvitationList(PageBean<MemberInvitation> pageBean) {
		// TODO Auto-generated method stub
		pageBean.setResults(mapper.getMemberInvitationList(pageBean));
		pageBean.setTotalCount(mapper.getMemberInvitationCount(pageBean));
	}

	@Override
	public void getMemberInvitationCoinlogList(PageBean<MemberInvitation> pageBean) {
		// TODO Auto-generated method stub
				pageBean.setResults(mapper.getMemberInvitationCoinlogList(pageBean));
				pageBean.setTotalCount(mapper.getMemberInvitationCoinlogCount(pageBean));
		
	}

	@Override
	public void getMemberInvitationActivityList(PageBean<MemberInvitation> pageBean) {
		// TODO Auto-generated method stub
		/*pageBean.setResults(mapper.getMemberInvitationActivityList(pageBean));*/
		List<MemberInvitation>  list = mapper.getMemberInvitationActivityList(pageBean);
		if(list!=null &&list.size()>0){
		for(MemberInvitation gors : list){
			 int userId = gors.getUserId();
				List<MemberInvitation> listName=this.mapper.queryyUserId(userId); 
				String titles = listName.get(0).getTitle();
				
				
				gors.setTitle(titles);;
			
		}
		
		}
		pageBean.setResults(list);
		pageBean.setTotalCount(mapper.getMemberInvitationActivityCount(pageBean));
	}
	
}
